package com.yanxx.codegenerator.storage;

import java.util.HashSet;
import java.util.Set;

/**
 * 编码生成器状态类
 * 用于存储编码生成器的当前状态
 */
public class CodeGeneratorState {
    
    private long currentMaxValue;
    private Set<String> confirmedCodes;
    private Set<String> pendingCodes;
    private Set<String> recycledCodes;
    
    public CodeGeneratorState() {
        this.currentMaxValue = 0;
        this.confirmedCodes = new HashSet<>();
        this.pendingCodes = new HashSet<>();
        this.recycledCodes = new HashSet<>();
    }
    
    public CodeGeneratorState(long currentMaxValue, Set<String> confirmedCodes, 
                             Set<String> pendingCodes, Set<String> recycledCodes) {
        this.currentMaxValue = currentMaxValue;
        this.confirmedCodes = confirmedCodes != null ? new HashSet<>(confirmedCodes) : new HashSet<>();
        this.pendingCodes = pendingCodes != null ? new HashSet<>(pendingCodes) : new HashSet<>();
        this.recycledCodes = recycledCodes != null ? new HashSet<>(recycledCodes) : new HashSet<>();
    }
    
    public long getCurrentMaxValue() {
        return currentMaxValue;
    }
    
    public void setCurrentMaxValue(long currentMaxValue) {
        this.currentMaxValue = currentMaxValue;
    }
    
    public Set<String> getConfirmedCodes() {
        return confirmedCodes;
    }
    
    public void setConfirmedCodes(Set<String> confirmedCodes) {
        this.confirmedCodes = confirmedCodes;
    }
    
    public Set<String> getPendingCodes() {
        return pendingCodes;
    }
    
    public void setPendingCodes(Set<String> pendingCodes) {
        this.pendingCodes = pendingCodes;
    }
    
    public Set<String> getRecycledCodes() {
        return recycledCodes;
    }
    
    public void setRecycledCodes(Set<String> recycledCodes) {
        this.recycledCodes = recycledCodes;
    }
}